﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace FDEE.Model
{
    class CPTM2S : CPTMBase
    {
        Dictionary<double, List<int>> dic = new Dictionary<double, List<int>>();
        Dictionary<double, List<int>> addDic = new Dictionary<double, List<int>>();
        bool isAdd = false;
        internal CPTM2S(string typeName, string pierNumber, eColumnType ct, eSubType st,
            int ww, int ll, int hh, int rr, double up, double low,
            eDB mainDB, string listCString = "", string listAddCString = "")
            : base(typeName, pierNumber, ct, st, ww, ll, hh, rr, up, low, mainDB)
        {
            if (st == eSubType.B || st == eSubType.C)
            {
                listCString = "{(2,10)|284};{(3,5,7,9)|202}";
                listAddCString = "{(3,5,7,9)|137}";
                List<string> listC = listCString.Split(';').ToList();
                List<string> listAddC = listAddCString.Split(';').ToList();
                Dictionary<double, List<int>> dicV = new Dictionary<double, List<int>>();

                foreach (var item in listC)
                {
                    string[] values = item.Replace("{", "").Replace("}", "").Replace("(","").Replace(")", "").Replace("（", "").Replace("）", "").Split('|');
                    double vk = double.Parse(values[1]);
                    string[] vs = values[0].Split(',');
                    List<int> v = new List<int>();
                    foreach (var vl in vs)
                    {
                        v.Add(int.Parse(vl));
                    }
                    if (!dicV.Keys.Contains(vk))
                        dicV.Add(vk, v);
                    dic = dicV;
                }
                Dictionary<double, List<int>> adddicV = new Dictionary<double, List<int>>();
                foreach (var item in listAddC)
                {
                    string[] values = item.Replace("{", "").Replace("}", "").Replace("(","").Replace(")", "").Replace("（", "").Replace("）", "").Split('|');
                    double vk = double.Parse(values[1]);
                    string[] vs = values[0].Split(',');
                    List<int> v = new List<int>();
                    foreach (var vl in vs)
                    {
                        v.Add(int.Parse(vl));
                    }
                    if (!adddicV.Keys.Contains(vk))
                        adddicV.Add(vk, v);
                    addDic = adddicV;
                }
            }
            else if (st == eSubType.D)
            {
                listCString = "{(2,3,9,10)|195};{(5,7)|135};{(6)|245}";
                listAddCString = "{(3,9)|195}";
                List<string> listC = listCString.Split(';').ToList();
                List<string> listAddC = listAddCString.Split(';').ToList();
                Dictionary<double, List<int>> dicV = new Dictionary<double, List<int>>();

                foreach (var item in listC)
                {
                    string[] values = item.Replace("{", "").Replace("}", "").Replace("(","").Replace(")", "").Replace("（", "").Replace("）", "").Split('|');
                    double vk = double.Parse(values[1]);
                    string[] vs = values[0].Split(',');
                    List<int> v = new List<int>();
                    foreach (var vl in vs)
                    {
                        v.Add(int.Parse(vl));
                    }
                    if (!dicV.Keys.Contains(vk))
                        dicV.Add(vk, v);
                    dic = dicV;
                }
                Dictionary<double, List<int>> adddicV = new Dictionary<double, List<int>>();
                foreach (var item in listAddC)
                {
                    string[] values = item.Replace("{", "").Replace("}", "").Replace("(","").Replace(")", "").Replace("（", "").Replace("）", "").Split('|');
                    double vk = double.Parse(values[1]);
                    string[] vs = values[0].Split(',');
                    List<int> v = new List<int>();
                    foreach (var vl in vs)
                    {
                        v.Add(int.Parse(vl));
                    }
                    if (!adddicV.Keys.Contains(vk))
                        adddicV.Add(vk, v);
                    addDic = adddicV;
                }
            }
            else if (!string.IsNullOrWhiteSpace(listCString))
            {
                List<string> listC = listCString.Split(';').ToList();
                List<string> listAddC = listAddCString.Split(';').ToList();
                Dictionary<double, List<int>> dicV = new Dictionary<double, List<int>>();

                foreach (var item in listC)
                {
                    string[] values = item.Replace("{", "").Replace("}", "").Replace("(","").Replace(")", "").Replace("（", "").Replace("）", "").Split('|');
                    double vk = double.Parse(values[1]);
                    string[] vs = values[0].Split(',');
                    List<int> v = new List<int>();
                    foreach (var vl in vs)
                    {
                        v.Add(int.Parse(vl));
                    }
                    if (!dicV.Keys.Contains(vk))
                        dicV.Add(vk, v);
                    //dic = dicV.OrderByDescending(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
                    dic = dicV.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
                }
                Dictionary<double, List<int>> adddicV = new Dictionary<double, List<int>>();
                foreach (var item in listAddC)
                {
                    string[] values = item.Replace("{", "").Replace("}", "").Replace("(","").Replace(")", "").Replace("（", "").Replace("）", "").Split('|');
                    double vk = double.Parse(values[1]);
                    string[] vs = values[0].Split(',');
                    List<int> v = new List<int>();
                    foreach (var vl in vs)
                    {
                        v.Add(int.Parse(vl));
                    }
                    if (!adddicV.Keys.Contains(vk))
                        adddicV.Add(vk, v);
                    //addDic = adddicV.OrderByDescending(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
                    addDic = adddicV.OrderBy(p => p.Key).ToDictionary(p => p.Key, o => o.Value);
                }
            }
        }

        public override void SetRebarDistribute()
        {
            double d1, d2;
            switch (SubType)
            {
                case eSubType.A:
                case eSubType.B:
                case eSubType.C:
                    d1 = Math.Round((Length - Radius * 2) / 12.0, 0);
                    d2 = Math.Round((Width - Radius * 2) / 7.0, 0);
                    //A截面参数
                    MainLBarDistribute = new RebarTendonDistribute(32, d1, 12);
                    AddLBarDistribute = new RebarTendonDistribute();
                    AddLBarDistribute.Location = MainLBarDistribute.Delete(new List<int>() { 0, 2, 4, 8, 10, 12 });
                    MainWBarDistribute = new RebarTendonDistribute(32, d2, 7);
                    AddWBarDistribute = new RebarTendonDistribute();
                    //B截面参数
                    MainLBarDistributeB = new RebarTendonDistribute(32, d1, 12);
                    AddLBarDistributeB = new RebarTendonDistribute();
                    MainWBarDistributeB = new RebarTendonDistribute(32, d2, 7);
                    AddWBarDistributeB = new RebarTendonDistribute();
                    //C截面参数
                    MainLBarDistributeC = new RebarTendonDistribute(32, d1, 12);
                    AddLBarDistributeC = new RebarTendonDistribute();
                    MainWBarDistributeC = new RebarTendonDistribute(32, d2, 7);
                    AddWBarDistributeC = new RebarTendonDistribute();
                    break;
                case eSubType.D:
                    d1 = Math.Round((Length - Radius * 2) / 12.0, 0);
                    d2 = Math.Round((Width - Radius * 2) / 7.0, 0);
                    d1 =130;
                    d2 = 110;
                    //A截面参数
                    MainLBarDistribute = new RebarTendonDistribute(32, d1, 12);
                    AddLBarDistribute = new RebarTendonDistribute();
                    AddLBarDistribute.Location = MainLBarDistribute.Delete(new List<int>() { 0, 2, 4,5,6,7, 8, 10, 12 });
                    MainWBarDistribute = new RebarTendonDistribute(32, d2, 7);
                    AddWBarDistribute = new RebarTendonDistribute();
                    //B截面参数
                    MainLBarDistributeB = new RebarTendonDistribute(32, d1, 12);
                    AddLBarDistributeB = new RebarTendonDistribute();
                    AddLBarDistributeB.Location = MainLBarDistribute.Delete(new List<int>() { 0, 2, 4, 5, 6, 7, 8, 10, 12 });
                    MainWBarDistributeB = new RebarTendonDistribute(32, d2, 7);
                    AddWBarDistributeB = new RebarTendonDistribute();
                    //C截面参数
                    MainLBarDistributeC = new RebarTendonDistribute(32, d1, 12);
                    AddLBarDistributeC = new RebarTendonDistribute();
                    AddLBarDistributeC.Location = MainLBarDistribute.Delete(new List<int>() { 0, 2, 4, 5, 6, 7, 8, 10, 12 });
                    MainWBarDistributeC = new RebarTendonDistribute(32, d2, 7);
                    AddWBarDistributeC = new RebarTendonDistribute();
                    break;
            }
        }

        public override void SetRebarList()
        {
            #region 0-箍筋
            int npts = GetStirrupNum();
            if (isAdd)
                RebarList.Add(new MORebarRecord(1, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[1] * -2 + 32 + (MainWBarDistribute.Location.Count - 1 * 2 - 1)));
            else
                RebarList.Add(new MORebarRecord(1, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[1] * -2 + 32));

            //RebarList.Add(new MORebarRecord(1, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[1] * -2 + 32));
            //RebarList.Add(new MORebarRecord(2, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[3] * -2 + 32));
            int tmpn = 3;
            int tmp2 = 3;

            //RebarList.Add(new MORebarRecord(2, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[tmp2] * -2 + 32));

            //RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 3, eShapeType.MO, Width - 100 - 24, MainLBarDistribute.Distance(1, tmpn) + 32));
            if (isAdd)
                RebarList.Add(new MORebarRecord(2, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[tmp2] * -2 + 32 + MainWBarDistribute.Location.Count - 2 * tmp2 - 1));
            else
                RebarList.Add(new MORebarRecord(2, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, (int)MainWBarDistribute.Location[tmp2] * -2 + 32));

            if (isAdd)
                RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 3, eShapeType.MO, Width - 100 - 24, MainLBarDistribute.Distance(1, tmpn) + 32 + tmpn - 1));
            else
                RebarList.Add(new MORebarRecord(3, 0, "", eDB.DB12, npts * 3, eShapeType.MO, Width - 100 - 24, MainLBarDistribute.Distance(1, tmpn) + 32));

            RebarList.Add(new MORebarRecord(4, 0, "", eDB.DB12, npts, eShapeType.MO, Length - 100 - 24, Width - 100 - 24, 138));
            #endregion

           
            #region 1-获取承台尺寸
            FootingBase theFooting = MemberFactory.CreatMember(MemberFactory.FromColumnToFooting(ColumnType), SubType);
            int FTHeight = theFooting.Height;
            int FTWidth = theFooting.Width;
            int FTLen = theFooting.Length;
            int db = (int)MainRebarDB;
            #endregion

            #region 2-起步筋
            int NumOFout = 0;// 外向起步筋
            int NumMainAll = MainWBarDistribute.Location.Count * 2 + MainLBarDistribute.Location.Count * 2 + 4;
            if ((FTWidth - Width) * 0.5 >= 600)
            {
                NumOFout += MainLBarDistributeC.Location.Count * 2;
            }
            if ((FTLen - Length) * 0.5 >= 600)
            {
                NumOFout += MainWBarDistributeC.Location.Count * 2 + 4;
            }
            //int NumAdd = AddLBarDistributeC.Location.Count * 2 + AddWBarDistributeC.Location.Count * 2;
            //5.1a为内侧起步筋，所有加强筋为内侧起步；
            //RebarList.Add(new MHXRebarRecord(5, 1, "a", MainRebarDB, true, NumMainAll - NumOFout + NumAdd, eShapeType.MHX));

            ////5.1b为外侧起步筋；
            //if (NumOFout != 0)
            //{
            //    RebarList.Add(new MHXRebarRecord(5, 1, "b", MainRebarDB, false, NumOFout, eShapeType.MHXe));
            //}
            string no5 = "a";
            if (NumMainAll - NumOFout > 0)
            {
                if (SubType == eSubType.C || SubType == eSubType.B || SubType == eSubType.D)
                    RebarList.Add(new MHXRebarRecord(5, 1, no5, MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX, 12000));
                else
                    RebarList.Add(new MHXRebarRecord(5, 1, no5, MainRebarDB, true, NumMainAll - NumOFout, eShapeType.MHX));
                no5 = "b";
            }
            //5.1b为外侧起步筋；
            if (NumOFout != 0)
            {
                if (no5 == "a")
                    no5 = "";
                if (SubType == eSubType.C || SubType == eSubType.B || SubType == eSubType.D)
                    RebarList.Add(new MHXRebarRecord(5, 1, no5, MainRebarDB, false, NumOFout, eShapeType.MHXe, 12000));
                else
                    RebarList.Add(new MHXRebarRecord(5, 1, no5, MainRebarDB, false, NumOFout, eShapeType.MHXe));
            }
            #endregion
            if (SubType == eSubType.D)
            {
                SetRebarListD();
            }
            else
            {
                #region 3-锚固筋

                //int Z1 = 8483 - (FTHeight - 210) - 1200; // 搭接节点 1//Z1=8483-(H-160)-1200
                //if (SubType == eSubType.C|| SubType == eSubType.B || SubType == eSubType.D)
                //    Z1 = 11483 - (FTHeight - 210) - 1200;
                #region 9/12m 250搭接
                int Z1 = 8494 - (FTHeight - 210) - 1200; // 搭接节点 1//Z1=8483-(H-160)-1200

                if (SubType == eSubType.B || SubType == eSubType.C || SubType == eSubType.D)
                    Z1 = 11494 - (FTHeight - 210) - 1200;
                #endregion
                int L2 = 0;// 盖梁锚固筋长度；
                int L12Num = 0;
                bool isDiv = false;
                int aa = (int)(1300 + LenUpper);
                if (PierHeight - Z1 + 1200 + 1500 > 12000)
                {
                    // 分3节
                    L12Num = NumMainAll;
                    isDiv = true;
                    //L2 = (PierHeight - Z1 + 1200 + 1500 - aa);
                    L2 = (PierHeight - Z1 + 1200 - aa);
                    if (L2 + 1200 * 2 > 12000 - 250 + 248)
                    {
                        aa += L2 + 1200 * 2 - (12000 - 250 + 248);
                        L2 = 12000 - 250 + 248 - 2400;
                    }
                }
                else
                {
                    int numA = MainWBarDistribute.Location.Count;
                    // 分2节
                    L2 = 1500 + (PierHeight - Z1) + 1200; // 深入盖梁钢筋总长度    
                    aa = L2 - 1500;
                }

                CrossbeamBase theCB = MemberFactory.CreatMember(MemberFactory.ColumnToCrossBeam(ColumnType), 0);
                NumMainAll = MainLBarDistribute.Location.Count * 2 + MainWBarDistribute.Location.Count * 2 + 4;
                int NumL = 0;//外侧L数量

                int NumS = 0;//直线
                int bb = 0;
                int cc = 0;//1500-(B-r/2-d);
                int dd = 0;
                //int aa = L2 - 1500;         
                //if (L2 - 1500 < 0)
                //    aa = 0;
                int rr = RebarKnowledge.GerRadius(eDB.DB32);
                string no = "a";
                // 5.2a为L锚固
                // 是否与预应力冲突 ？Y:B=100
                if (Math.Abs(Length - 50 - 12 - 16 - theCB.TendonDistribute.Location[0] * -1) <= theCB.TendonDistribute.Diameter * 0.5)
                {
                    // 外侧主筋L型避让
                    bb = 100;
                    cc = (int)(1500 - bb - rr * 0.5 - 32);
                    NumL += MainWBarDistribute.Location.Count * 2 + 4;
                    //RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumL, eShapeType.ML, aa, bb, cc, rr));
                    //no = "b";
                }
                else
                {
                    // 此时，W主筋无需避让预应力，应分析是否可以直锚？
                    // 若无预应力冲突，但盖梁空间不足，B=theCB.CalculatedHeight-100
                    // 外侧主筋L型避让
                    bool isEixt = false;//是否在安全距离
                    foreach (double item in MainLBarDistribute.Location.Values)
                    {
                        //第一个对比
                        if (Math.Abs(item) > theCB.L2 * 0.5 - 82)
                        {
                            isEixt = true;
                        }
                        break;

                    }
                    if (isEixt)//与盖梁顶部安全距离判断；
                    {
                        bb = theCB.CalculatedHeight - 100;
                        cc = (int)(1500 - bb + rr * 0.5 + 32);
                        NumL += MainWBarDistribute.Location.Count * 2 + 4;
                        //RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumL, eShapeType.ML, aa, bb, cc, rr));
                        //no = "b";
                    }
                    else
                    {
                        //直线布置 长度A+B
                        bb = 1500;
                        NumS += MainWBarDistribute.Location.Count * 2 + 4;
                        //RebarList.Add(new MLSRebarRecord(5, 2, no, MainRebarDB, NumL, eShapeType.ML, aa, bb));                  
                        //no = "b";
                    }
                }
                int NumLSZ = 0;
                ////预应力冲突 闪电避让
                //foreach (double item in MainLBarDistribute.Location.Values)
                //{
                //    foreach (double itemY in theCB.TendonDistribute.Location.Values)
                //    {
                //        if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                //            NumLSZ++;
                //    }
                //}
                int numL = 0, numS = 0; //避开预应力的主筋直线和L数量
                int NumLC = 0;//不冲突的
                int i = 0;
                Dictionary<int, string> dicDY = new Dictionary<int, string>();
                foreach (double item in MainLBarDistribute.Location.Values)
                {
                    if (Math.Abs(item) > theCB.L2 * 0.5 - 82)//安全距离之外 L
                    {
                        bool isConflict = false;
                        foreach (double itemY in theCB.TendonDistribute.Location.Values)
                        {
                            if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                            {
                                isConflict = true;
                                break;
                            }
                        }
                        //if (!isConflict)
                        //    NumLC++;
                        //else
                        numL++;
                        dicDY.Add(i, "L");
                    }
                    else //安全距离之内 
                    {
                        bool isSpecial = false;
                        bool isConflict = false;
                        foreach (double itemY in theCB.TendonDistribute.Location.Values)
                        {
                            if (itemY == 0 && item == 0)
                            {
                                isSpecial = true;
                                break;
                            }
                            if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                            {
                                isConflict = true;
                                break;
                            }
                        }
                        if (!isSpecial)
                        {
                            if (!isConflict)
                            {
                                numS++;
                                dicDY.Add(i, "直线");
                            }
                            else
                            {
                                dicDY.Add(i, "闪电");
                            }
                        }
                        else
                        {
                            numL++;
                            dicDY.Add(i, "L");
                        }
                    }
                    i++;
                }

                string mesage = "";
                foreach (int key in dicDY.Keys)
                {

                    TextOper.WriteFile(key, dicDY[key], "PTM2S" + SubType.ToString());
                }


                NumS += numS * 2;
                NumL += numL * 2 + NumLC * 2;
                NumLC = NumLC * 2;

                //其他
                int NumLS = NumMainAll - NumS - NumL;//闪电型         
                if (NumS > 0)
                {
                    //直线锚固
                    RebarList.Add(new MLSRebarRecord(5, 2, no, MainRebarDB, NumS, eShapeType.MLS, aa, 1500));
                    if (no == "a")
                        no = "b";
                    else if (no == "b")
                        no = "c";
                    else if (no == "c")
                        no = "d";
                    else if (no == "d")
                        no = "e";
                    else if (no == "e")
                        no = "f";
                    else if (no == "f")
                        no = "g";
                    else
                        no = "h";
                }
                if (NumLS > 0)
                {
                    bb = 100;
                    cc = 180;
                    dd = 1500 - 100 - 180;
                    int numAll = 0;
                    foreach (var key in dic.Keys)
                    {
                        numAll += dic[key].Count * 2;
                    }
                    if (numAll == NumLS)
                    {
                        foreach (var key in dic.Keys)
                        {
                            cc = (int)key;
                            dd = 1500 - 100 - (int)key;
                            int count = dic[key].Count * 2;
                            //闪电锚固
                            RebarList.Add(new MLZRebarRecord(5, 2, no, MainRebarDB, count, eShapeType.MLZ, aa, bb, cc, dd));
                            if (no == "a")
                                no = "b";
                            else if (no == "b")
                                no = "c";
                            else if (no == "c")
                                no = "d";
                            else if (no == "d")
                                no = "e";
                            else if (no == "e")
                                no = "f";
                            else if (no == "f")
                                no = "g";
                            else
                                no = "h";
                        }
                    }
                    else
                    {
                        RebarList.Add(new MLZRebarRecord(5, 2, no, MainRebarDB, NumLS, eShapeType.MLZ, aa, bb, cc, dd));
                        if (no == "a")
                            no = "b";
                        else if (no == "b")
                            no = "c";
                        else if (no == "c")
                            no = "d";
                        else if (no == "d")
                            no = "e";
                        else if (no == "e")
                            no = "f";
                        else if (no == "f")
                            no = "g";
                        else
                            no = "h";
                    }

                }
                if (NumL > 0)
                {
                    //L锚固

                    if (NumL - NumLC > 0)
                    {
                        bb = 100;
                        cc = (int)(1500 - bb + rr * 0.5 + 32);
                        RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumL - NumLC, eShapeType.ML, aa, bb, cc, rr));
                        if (no == "a")
                            no = "b";
                        else if (no == "b")
                            no = "c";
                        else if (no == "c")
                            no = "d";
                        else if (no == "d")
                            no = "e";
                        else if (no == "e")
                            no = "f";
                        else if (no == "f")
                            no = "g";
                        else
                            no = "h";
                    }
                    if (NumLC > 0)
                    {
                        bb = 100;
                        cc = (int)(1500 - bb + rr * 0.5 + 32);
                        RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumLC, eShapeType.ML, aa, bb, cc, rr));
                    }
                }
                if (isDiv)
                {
                    RebarList.Add(new MSZRebarRecord(5, 3, "", MainRebarDB, NumMainAll, eShapeType.MSZ, L2 + 1200 * 2));
                }
                #endregion


                #region 4 起步加强筋6.1
                int add = 1;
                int NumAddOFout = 0;// 外向起步筋
                int NumAddMainAll = AddWBarDistributeC.Location.Count * 2 + AddLBarDistributeC.Location.Count * 2;
                if (NumAddMainAll > 0)
                {
                    if ((FTWidth - Width) * 0.5 >= 600)
                    {
                        NumAddOFout += AddLBarDistributeC.Location.Count * 2;
                    }
                    if ((FTLen - Length) * 0.5 >= 600)
                    {
                        NumAddOFout += AddWBarDistributeC.Location.Count * 2;
                    }

                    string no6 = "a";
                    if (NumAddMainAll - NumAddOFout > 0)
                    {
                        RebarList.Add(new MHXRebarRecord(6, 1, no6, MainRebarDB, true, NumAddMainAll - NumAddOFout, eShapeType.MHX));
                        no6 = "b";
                    }
                    //5.1b为外侧起步筋；
                    if (NumAddOFout != 0)
                    {
                        if (no6 == "a")
                            no6 = "";
                        RebarList.Add(new MHXRebarRecord(6, 1, no6, MainRebarDB, false, NumAddOFout, eShapeType.MHXe));
                    }
                    add = 2;
                }
                #endregion

                #region 5 加强锚固6.2
                int NumAddL = 0;//外侧L数量
                int NumAddS = 0; //直线数量
                int NumAddAll = AddWBarDistribute.Location.Count * 2 + AddLBarDistribute.Location.Count * 2;
                aa = (int)(1300 + LenUpper);
                no = "a";
                if (Math.Abs(Length - 50 - 12 - 16 - theCB.TendonDistribute.Location[0] * -1) <= theCB.TendonDistribute.Diameter * 0.5)
                {
                    // 外侧主筋L型避让
                    bb = 100;
                    cc = (int)(1500 - bb + rr * 0.5 + 32);
                    NumAddL += AddWBarDistribute.Location.Count * 2;
                    //if (NumAddL > 0)
                    //{
                    //    RebarList.Add(new MLRebarRecord(5, 3, no, MainRebarDB, NumAddL, eShapeType.ML, aa, bb, cc, rr));
                    //    no = "b";
                    //}
                }
                else
                {
                    // 若无预应力冲突，但盖梁空间不足，B=theCB.CalculatedHeight-100
                    // 外侧主筋L型避让
                    bool isEixt = false;//是否安全距离内
                    foreach (double item in AddLBarDistribute.Location.Values)
                    {
                        //第一个对比
                        if (Math.Abs(item) > theCB.L2 * 0.5 - 82)
                        {
                            isEixt = true;
                        }
                        break;
                    }
                    if (isEixt)
                    {
                        bb = theCB.CalculatedHeight - 100;
                        cc = (int)(1500 - bb + rr * 0.5 + 32);
                        NumAddL += AddWBarDistribute.Location.Count * 2;

                    }
                    else
                    {
                        //直线布置 长度A+B
                        bb = 1500;
                        NumAddL += AddWBarDistribute.Location.Count * 2;

                    }
                }

                int numAddL = 0, numAddS = 0;//避开预应力的加强筋直线和L数量
                int NumAddLC = 0;//冲突
                int n = 0;
                Dictionary<int, string> dicAddDY = new Dictionary<int, string>();

                foreach (double item in AddLBarDistribute.Location.Values)
                {
                    if (Math.Abs(item) > theCB.L2 * 0.5 - 82)//安全距离之外 L
                    {

                        bool isConflict = false;
                        foreach (double itemY in theCB.TendonDistribute.Location.Values)
                        {

                            if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                            {
                                isConflict = true;
                                break;
                            }
                        }
                        //if (!isConflict)
                        //    NumAddLC++;
                        //else
                        numAddL++;
                        dicAddDY.Add(n, "L");
                    }
                    else //安全距离之内 直线
                    {
                        bool isConflict = false;
                        bool isSpecial = false;
                        foreach (double itemY in theCB.TendonDistribute.Location.Values)
                        {
                            if (itemY == 0 && item == 0)
                            {
                                isSpecial = true;
                                break;
                            }
                            if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                            {
                                isConflict = true;
                                break;
                            }
                        }
                        //if (isConflict)
                        //    numAddS++;
                        if (!isSpecial)
                        {
                            if (!isConflict)
                            {
                                numAddS++;
                                dicAddDY.Add(n, "直线");
                            }
                            else
                            {
                                dicAddDY.Add(n, "闪电");
                            }
                        }
                        else
                        {
                            numAddL++;
                            dicAddDY.Add(n, "L");
                        }

                    }
                    n++;
                }
                //numAddLL = numAddLL * 2;
                NumAddS += numAddS * 2;
                NumAddL += numAddL * 2 + NumAddLC * 2;
                NumAddLC = NumAddLC * 2;
                //其他的闪电锚固
                int NumAddLS = NumAddAll - NumAddS - NumAddL;

                if (NumAddS > 0)
                {
                    RebarList.Add(new MLSRebarRecord(6, add, no, MainRebarDB, NumAddS, eShapeType.MLS, aa, 1500));
                    if (no == "a")
                        no = "b";
                    else if (no == "b")
                        no = "c";
                    else if (no == "c")
                        no = "d";
                    else if (no == "d")
                        no = "e";
                    else if (no == "e")
                        no = "f";
                    else if (no == "f")
                        no = "g";
                    else
                        no = "h";
                }

                if (NumAddLS > 0)
                {
                    cc = 180;
                    bb = 100;
                    dd = 1500 - 180 - 100;
                    int numAll = 0;
                    foreach (var key in addDic.Keys)
                    {
                        numAll += addDic[key].Count * 2;
                    }
                    if (numAll == NumAddLS)
                    {
                        foreach (var key in addDic.Keys)
                        {
                            cc = (int)key;
                            dd = 1500 - 100 - (int)key;
                            int count = addDic[key].Count * 2;
                            //闪电锚固
                            RebarList.Add(new MLZRebarRecord(6, add, no, MainRebarDB, count, eShapeType.MLZ, aa, bb, cc, dd));
                            if (no == "a")
                                no = "b";
                            else if (no == "b")
                                no = "c";
                            else if (no == "c")
                                no = "d";
                            else if (no == "d")
                                no = "e";
                            else if (no == "e")
                                no = "f";
                            else if (no == "f")
                                no = "g";
                            else
                                no = "h";
                        }
                    }
                    else
                    {
                        RebarList.Add(new MLZRebarRecord(6, add, no, MainRebarDB, NumAddLS, eShapeType.MLZ, aa, bb, cc, dd));
                        if (no == "a")
                            no = "b";
                        else if (no == "b")
                            no = "c";
                        else if (no == "c")
                            no = "d";
                        else if (no == "d")
                            no = "e";
                        else if (no == "e")
                            no = "f";
                        else if (no == "f")
                            no = "g";
                        else
                            no = "h";
                    }
                }
                if (NumAddL > 0)
                {

                    if (NumAddL - NumAddLC > 0)
                    {
                        bb = 100;
                        cc = (int)(1500 - bb + rr * 0.5 + 32);
                        RebarList.Add(new MLRebarRecord(6, add, no, MainRebarDB, NumAddL - NumAddLC, eShapeType.ML, aa, bb, cc, rr));
                        if (no == "a")
                            no = "b";
                        else if (no == "b")
                            no = "c";
                        else if (no == "c")
                            no = "d";
                        else if (no == "d")
                            no = "e";
                        else if (no == "e")
                            no = "f";
                        else if (no == "f")
                            no = "g";
                        else
                            no = "h";
                    }
                    if (NumAddLC > 0)
                    {

                        bb = 100;
                        cc = (int)(1500 - bb + rr * 0.5 + 32);

                        RebarList.Add(new MLRebarRecord(6, add, no, MainRebarDB, NumAddLC, eShapeType.ML, aa, bb, cc, rr));
                    }
                }
                #endregion

                #region UBlot数量计算
                if (isDiv)
                    UAN1N2 = NumMainAll * 8;
                else
                    UAN1N2 = NumMainAll * 4;
                if (isDiv)
                {
                    UboltList.UBoltNum[MainRebarDB] += NumMainAll * 8;                  
                }
                else
                {
                    UboltList.UBoltNum[MainRebarDB] += NumMainAll * 4;                 
                }
                #endregion
            }
        }


        public  void SetRebarListD()
        {
            #region 1-获取承台尺寸
            FootingBase theFooting = MemberFactory.CreatMember(MemberFactory.FromColumnToFooting(ColumnType), SubType);
            int FTHeight = theFooting.Height;
            int FTWidth = theFooting.Width;
            int FTLen = theFooting.Length;
            int db = (int)MainRebarDB;
            #endregion
            int NumOFout = 0;// 外向起步筋
            int NumMainAll = MainWBarDistribute.Location.Count * 2 + MainLBarDistribute.Location.Count * 2 + 4;
            if ((FTWidth - Width) * 0.5 >= 600)
            {
                NumOFout += MainLBarDistributeC.Location.Count * 2;
            }
            if ((FTLen - Length) * 0.5 >= 600)
            {
                NumOFout += MainWBarDistributeC.Location.Count * 2 + 4;
            }
            #region 3-锚固筋

            //int Z1 = 8483 - (FTHeight - 210) - 1200; // 搭接节点 1//Z1=8483-(H-160)-1200
            //if (SubType == eSubType.C|| SubType == eSubType.B || SubType == eSubType.D)
            //    Z1 = 11483 - (FTHeight - 210) - 1200;
            #region 9/12m 250搭接
            int Z1 = 8494 - (FTHeight - 210) - 1200; // 搭接节点 1//Z1=8483-(H-160)-1200

            if (SubType == eSubType.C || SubType == eSubType.D)
                Z1 = 11494 - (FTHeight - 210) - 1200;
            #endregion
            int L2 = 0;// 盖梁锚固筋长度；
            int L12Num = 0;
            bool isDiv = false;
            int aa = (int)(1300 + LenUpper);
            if (PierHeight - Z1 + 1200 + 1500 > 12000)
            {
                // 分3节
                L12Num = NumMainAll;
                isDiv = true;
                //L2 = (PierHeight - Z1 + 1200 + 1500 - aa);
                L2 = (PierHeight - Z1 + 1200 - aa);
                if (L2 + 1200 * 2 > 12000 - 250 + 248)
                {
                    aa += L2 + 1200 * 2 - (12000 - 250 + 248);
                    L2 = 12000 - 250 + 248 - 2400;
                }
            }
            else
            {
                int numA = MainWBarDistribute.Location.Count;
                // 分2节
                L2 = 1500 + (PierHeight - Z1) + 1200; // 深入盖梁钢筋总长度    
                aa = L2 - 1500;
            }

            CrossbeamBase theCB = MemberFactory.CreatMember(MemberFactory.ColumnToCrossBeam(ColumnType), 0);
            NumMainAll = MainLBarDistribute.Location.Count * 2 + MainWBarDistribute.Location.Count * 2 + 4;
            int NumL = 0;//外侧L数量

            int NumS = 0;//直线
            int bb = 0;
            int cc = 0;//1500-(B-r/2-d);
            int dd = 0;
            //int aa = L2 - 1500;         
            //if (L2 - 1500 < 0)
            //    aa = 0;
            int rr = RebarKnowledge.GerRadius(eDB.DB32);
            string no = "a";
            // 5.2a为L锚固
            // 是否与预应力冲突 ？Y:B=100
            if (Math.Abs(Length - 50 - 12 - 16 - theCB.TendonDistribute.Location[0] * -1) <= theCB.TendonDistribute.Diameter * 0.5)
            {
                // 外侧主筋L型避让
                bb = 100;
                cc = (int)(1500 - bb - rr * 0.5 - 32);
                NumL += MainWBarDistribute.Location.Count * 2 + 4;
                //RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumL, eShapeType.ML, aa, bb, cc, rr));
                //no = "b";
            }
            else
            {
                // 此时，W主筋无需避让预应力，应分析是否可以直锚？
                // 若无预应力冲突，但盖梁空间不足，B=theCB.CalculatedHeight-100
                // 外侧主筋L型避让
                bool isEixt = false;//是否在安全距离
                foreach (double item in MainLBarDistribute.Location.Values)
                {
                    //第一个对比
                    if (Math.Abs(item) > theCB.L2 * 0.5 - 82)
                    {
                        isEixt = true;
                    }
                    break;

                }
                if (isEixt)//与盖梁顶部安全距离判断；
                {
                    bb = theCB.CalculatedHeight - 100;
                    cc = (int)(1500 - bb + rr * 0.5 + 32);
                    NumL += MainWBarDistribute.Location.Count * 2 + 4;
                    //RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumL, eShapeType.ML, aa, bb, cc, rr));
                    //no = "b";
                }
                else
                {
                    //直线布置 长度A+B
                    bb = 1500;
                    NumS += MainWBarDistribute.Location.Count * 2 + 4;
                    //RebarList.Add(new MLSRebarRecord(5, 2, no, MainRebarDB, NumL, eShapeType.ML, aa, bb));                  
                    //no = "b";
                }
            }
            int NumLSZ = 0;
            ////预应力冲突 闪电避让
            //foreach (double item in MainLBarDistribute.Location.Values)
            //{
            //    foreach (double itemY in theCB.TendonDistribute.Location.Values)
            //    {
            //        if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
            //            NumLSZ++;
            //    }
            //}
            int numL = 0, numS = 0; //避开预应力的主筋直线和L数量
            int NumLC = 0;//不冲突的
            int i = 0;
            Dictionary<int, string> dicDY = new Dictionary<int, string>();
            foreach (double item in MainLBarDistribute.Location.Values)
            {
                if (Math.Abs(item) > theCB.L2 * 0.5 - 82)//安全距离之外 L
                {
                    bool isConflict = false;
                    foreach (double itemY in theCB.TendonDistribute.Location.Values)
                    {
                        if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                        {
                            isConflict = true;
                            break;
                        }
                    }
                    //if (!isConflict)
                    //    NumLC++;
                    //else
                    numL++;
                    dicDY.Add(i, "L");
                }
                else //安全距离之内 
                {
                    bool isSpecial = false;
                    bool isConflict = false;
                    foreach (double itemY in theCB.TendonDistribute.Location.Values)
                    {
                        if (itemY == 0 && item == 0)
                        {
                            isSpecial = true;
                            break;
                        }
                        if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                        {
                            isConflict = true;
                            break;
                        }
                    }
                    if (!isSpecial)
                    {
                        if (!isConflict)
                        {
                            numS++;
                            dicDY.Add(i, "直线");
                        }
                        else
                        {
                            dicDY.Add(i, "闪电");
                        }
                    }
                    else
                    {
                        numL++;
                        dicDY.Add(i, "L");
                    }
                }
                i++;
            }

            string mesage = "";
            foreach (int key in dicDY.Keys)
            {

                TextOper.WriteFile(key, dicDY[key], "PTM2S" + SubType.ToString());
            }


            NumS += numS * 2;
            //NumL += numL * 2 + NumLC * 2;
            NumLC = NumLC * 2;
            NumL += 4 * 2;
            //其他
            int NumLS = NumMainAll - NumS - NumL;//闪电型         
            if (NumS > 0)
            {
                //直线锚固
                RebarList.Add(new MLSRebarRecord(5, 2, no, MainRebarDB, NumS, eShapeType.MLS, aa, 1500));
                if (no == "a")
                    no = "b";
                else if (no == "b")
                    no = "c";
                else if (no == "c")
                    no = "d";
                else if (no == "d")
                    no = "e";
                else if (no == "e")
                    no = "f";
                else if (no == "f")
                    no = "g";
                else
                    no = "h";
            }
            if (NumLS > 0)
            {
                bb = 100;
                cc = 180;
                dd = 1500 - 100 - 180;
                int numAll = 0;
                foreach (var key in dic.Keys)
                {
                    numAll += dic[key].Count * 2;
                }
                if (numAll == NumLS)
                {
                    foreach (var key in dic.Keys)
                    {
                        cc = (int)key;
                        dd = 1500 - 100 - (int)key;
                        int count = dic[key].Count * 2;
                        //闪电锚固
                        RebarList.Add(new MLZRebarRecord(5, 2, no, MainRebarDB, count, eShapeType.MLZ, aa, bb, cc, dd));
                        if (no == "a")
                            no = "b";
                        else if (no == "b")
                            no = "c";
                        else if (no == "c")
                            no = "d";
                        else if (no == "d")
                            no = "e";
                        else if (no == "e")
                            no = "f";
                        else if (no == "f")
                            no = "g";
                        else
                            no = "h";
                    }
                }
                else
                {
                    RebarList.Add(new MLZRebarRecord(5, 2, no, MainRebarDB, NumLS, eShapeType.MLZ, aa, bb, cc, dd));
                    if (no == "a")
                        no = "b";
                    else if (no == "b")
                        no = "c";
                    else if (no == "c")
                        no = "d";
                    else if (no == "d")
                        no = "e";
                    else if (no == "e")
                        no = "f";
                    else if (no == "f")
                        no = "g";
                    else
                        no = "h";
                }

            }
            if (NumL > 0)
            {
                //L锚固

                if (NumL - NumLC > 0)
                {
                    bb = theCB.CalculatedHeight - 100;
                    cc = (int)(1500 - bb + rr * 0.5 + 32);
                    RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumL - NumLC, eShapeType.ML, aa, bb, cc, rr));
                    if (no == "a")
                        no = "b";
                    else if (no == "b")
                        no = "c";
                    else if (no == "c")
                        no = "d";
                    else if (no == "d")
                        no = "e";
                    else if (no == "e")
                        no = "f";
                    else if (no == "f")
                        no = "g";
                    else
                        no = "h";
                }
                if (NumLC > 0)
                {
                    bb = 100;
                    cc = (int)(1500 - bb + rr * 0.5 + 32);
                    RebarList.Add(new MLRebarRecord(5, 2, no, MainRebarDB, NumLC, eShapeType.ML, aa, bb, cc, rr));
                }
            }
            if (isDiv)
            {
                RebarList.Add(new MSZRebarRecord(5, 3, "", MainRebarDB, NumMainAll, eShapeType.MSZ, L2 + 1200 * 2));
            }
            #endregion


            #region 4 起步加强筋6.1
            int add = 1;
            int NumAddOFout = 0;// 外向起步筋
            int NumAddMainAll = AddWBarDistributeC.Location.Count * 2 + AddLBarDistributeC.Location.Count * 2;
            if (NumAddMainAll > 0)
            {
                if ((FTWidth - Width) * 0.5 >= 600)
                {
                    NumAddOFout += AddLBarDistributeC.Location.Count * 2;
                }
                if ((FTLen - Length) * 0.5 >= 600)
                {
                    NumAddOFout += AddWBarDistributeC.Location.Count * 2;
                }

                string no6 = "a";
                //if(NumAddOFout == 0)
                //    no6 = "";
                if (NumAddMainAll - NumAddOFout > 0)
                {
                    RebarList.Add(new MHXRebarRecord(6, 1, no6, MainRebarDB, true, NumAddMainAll - NumAddOFout, eShapeType.MHX, 12000));
                    if(no6 == "")
                        no6 = "a";
                    else if (no6 == "a")
                       no6 = "b";
                }
                //5.1b为外侧起步筋；
                if (NumAddOFout != 0)
                {
                    if (no6 == "a")
                        no6 = "";
                    RebarList.Add(new MHXRebarRecord(6, 1, no6, MainRebarDB, false, NumAddOFout, eShapeType.MHXe, 12000));
                }
                add = 2;
            }
            #endregion

            #region 5 加强锚固6.2
            int NumAddL = 0;//外侧L数量
            int NumAddS = 0; //直线数量
            int NumAddAll = AddWBarDistribute.Location.Count * 2 + AddLBarDistribute.Location.Count * 2;
            aa = (int)(1300 + LenUpper);
            no = "a";
            if (Math.Abs(Length - 50 - 12 - 16 - theCB.TendonDistribute.Location[0] * -1) <= theCB.TendonDistribute.Diameter * 0.5)
            {
                // 外侧主筋L型避让
                bb = 100;
                cc = (int)(1500 - bb + rr * 0.5 + 32);
                NumAddL += AddWBarDistribute.Location.Count * 2;
                //if (NumAddL > 0)
                //{
                //    RebarList.Add(new MLRebarRecord(5, 3, no, MainRebarDB, NumAddL, eShapeType.ML, aa, bb, cc, rr));
                //    no = "b";
                //}
            }
            else
            {
                // 若无预应力冲突，但盖梁空间不足，B=theCB.CalculatedHeight-100
                // 外侧主筋L型避让
                bool isEixt = false;//是否安全距离内
                foreach (double item in AddLBarDistribute.Location.Values)
                {
                    //第一个对比
                    if (Math.Abs(item) > theCB.L2 * 0.5 - 82)
                    {
                        isEixt = true;
                    }
                    break;
                }
                if (isEixt)
                {
                    bb = theCB.CalculatedHeight - 100;
                    cc = (int)(1500 - bb + rr * 0.5 + 32);
                    NumAddL += AddWBarDistribute.Location.Count * 2;

                }
                else
                {
                    //直线布置 长度A+B
                    bb = 1500;
                    NumAddL += AddWBarDistribute.Location.Count * 2;

                }
            }

            int numAddL = 0, numAddS = 0;//避开预应力的加强筋直线和L数量
            int NumAddLC = 0;//冲突
            int n = 0;
            Dictionary<int, string> dicAddDY = new Dictionary<int, string>();

            foreach (double item in AddLBarDistribute.Location.Values)
            {
                if (Math.Abs(item) > theCB.L2 * 0.5 - 82)//安全距离之外 L
                {

                    bool isConflict = false;
                    foreach (double itemY in theCB.TendonDistribute.Location.Values)
                    {

                        if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                        {
                            isConflict = true;
                            break;
                        }
                    }
                    //if (!isConflict)
                    //    NumAddLC++;
                    //else
                    numAddL++;
                    dicAddDY.Add(n, "L");
                }
                else //安全距离之内 直线
                {
                    bool isConflict = false;
                    bool isSpecial = false;
                    foreach (double itemY in theCB.TendonDistribute.Location.Values)
                    {
                        if (itemY == 0 && item == 0)
                        {
                            isSpecial = true;
                            break;
                        }
                        if (Math.Abs(itemY - item) < theCB.TendonDistribute.Diameter * 0.5)
                        {
                            isConflict = true;
                            break;
                        }
                    }
                    //if (isConflict)
                    //    numAddS++;
                    if (!isSpecial)
                    {
                        if (!isConflict)
                        {
                            numAddS++;
                            dicAddDY.Add(n, "直线");
                        }
                        else
                        {
                            dicAddDY.Add(n, "闪电");
                        }
                    }
                    else
                    {
                        numAddL++;
                        dicAddDY.Add(n, "L");
                    }

                }
                n++;
            }
            //numAddLL = numAddLL * 2;
            NumAddS += numAddS * 2;
            NumAddL += numAddL * 2 + NumAddLC * 2;
            NumAddLC = NumAddLC * 2;
            //其他的闪电锚固
            int NumAddLS = NumAddAll - NumAddS - NumAddL;

            if (NumAddS > 0)
            {
                RebarList.Add(new MLSRebarRecord(6, add, no, MainRebarDB, NumAddS, eShapeType.MLS, aa, 1500));
                if (no == "a")
                    no = "b";
                else if (no == "b")
                    no = "c";
                else if (no == "c")
                    no = "d";
                else if (no == "d")
                    no = "e";
                else if (no == "e")
                    no = "f";
                else if (no == "f")
                    no = "g";
                else
                    no = "h";
            }

            if (NumAddLS > 0)
            {
                cc = 180;
                bb = 100;
                dd = 1500 - 180 - 100;
                int numAll = 0;
                foreach (var key in addDic.Keys)
                {
                    numAll += addDic[key].Count * 2;
                }
                if (numAll == NumAddLS)
                {
                    foreach (var key in addDic.Keys)
                    {
                        cc = (int)key;
                        dd = 1500 - 100 - (int)key;
                        int count = addDic[key].Count * 2;
                        //闪电锚固
                        RebarList.Add(new MLZRebarRecord(6, add, no, MainRebarDB, count, eShapeType.MLZ, aa, bb, cc, dd));
                        if (no == "a")
                            no = "b";
                        else if (no == "b")
                            no = "c";
                        else if (no == "c")
                            no = "d";
                        else if (no == "d")
                            no = "e";
                        else if (no == "e")
                            no = "f";
                        else if (no == "f")
                            no = "g";
                        else
                            no = "h";
                    }
                }
                else
                {
                    RebarList.Add(new MLZRebarRecord(6, add, no, MainRebarDB, NumAddLS, eShapeType.MLZ, aa, bb, cc, dd));
                    if (no == "a")
                        no = "b";
                    else if (no == "b")
                        no = "c";
                    else if (no == "c")
                        no = "d";
                    else if (no == "d")
                        no = "e";
                    else if (no == "e")
                        no = "f";
                    else if (no == "f")
                        no = "g";
                    else
                        no = "h";
                }
            }
            if (NumAddL > 0)
            {

                //if (NumAddL - NumAddLC > 0)
                //{
                    bb = theCB.CalculatedHeight - 100;
                    cc = (int)(1500 - bb + rr * 0.5 + 32);
                    RebarList.Add(new MLRebarRecord(6, add, no, MainRebarDB, NumAddL - NumAddLC, eShapeType.ML, aa, bb, cc, rr));
                    if (no == "a")
                        no = "b";
                    else if (no == "b")
                        no = "c";
                    else if (no == "c")
                        no = "d";
                    else if (no == "d")
                        no = "e";
                    else if (no == "e")
                        no = "f";
                    else if (no == "f")
                        no = "g";
                    else
                        no = "h";
                //}
                //if (NumAddLC > 0)
                //{

                //    bb = 100;
                //    cc = (int)(1500 - bb + rr * 0.5 + 32);

                //    RebarList.Add(new MLRebarRecord(6, add, no, MainRebarDB, NumAddLC, eShapeType.ML, aa, bb, cc, rr));
                //}
            }
            if (isDiv&& (AddWBarDistributeB.Location.Count+ AddLBarDistributeB.Location.Count)>0)
            {
                RebarList.Add(new MSZRebarRecord(6, 3, "", MainRebarDB, NumAddAll, eShapeType.MSZ, L2 + 1200 * 2));
            }
            #endregion

            #region UBlot数量计算
            if (isDiv)
                UAN1N2 = NumMainAll * 8+ NumAddAll*8;
            else
                UAN1N2 = NumMainAll * 4;
            if (isDiv)
            {
                UboltList.UBoltNum[MainRebarDB] += NumMainAll * 8;
            }
            else
            {
                UboltList.UBoltNum[MainRebarDB] += NumMainAll * 4;
            }
            #endregion
        }
    }
}
